import React from 'react'
import {CircleToggleButton} from "../../../common/button/CircleToggleButton"
import {NodeEditor} from "../../../FlowNodeEditor/NodeEditor"


export class EditButton extends React.Component {
    constructor (props) {
        super(props)
        this.state = {
            modal: false,
        }

        this.toggle = this.toggle.bind(this)
    }

    toggle () {
        this.setState({
            modal: !this.state.modal,
        })
    }

    render () {
        const {selectedNode} = this.props

        return (
            <div>
                <CircleToggleButton id="btn-edit" buttonIcon="fa fa-edit" tooltip="Edit" onClick={this.toggle}/>
                <NodeEditor  toggle={this.toggle} isOpen={this.state.modal} selectedNode={selectedNode}/>
            </div>
        )
    }
}
